package com.codingvip.dynamic;

public class MaxSequence {
    private int[] seq = {2, 9, 3, 6, 5, 1, 7};
    private int[] max = new int[7];
    private int maxIndex = -1;


    public int getMaxSeq(int[] a, int n) {
        if(n==0) {
            maxIndex = 1;
            max[0] = a[0];
            return 1;
        }
        int lastMaxLen = getMaxSeq(a, n - 1);
        //如果a[i]>已有序列中的最大值 则 总的序列长度+1；否则取序列的长度
        if(a[n-1]>max[lastMaxLen-1]) {
            return lastMaxLen + 1;
        }else{
            return lastMaxLen;
        }
    }
}
